package com.lys.controller;

import com.lys.service.CityDataService;
import com.lys.vo.City;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/city")
public class CityController {
    private final static Logger logger= LoggerFactory.getLogger(CityController.class);
    @Autowired
    private CityDataService cityDataService;
    @RequestMapping(value = "/listCity",method = RequestMethod.GET)
    public List<City> listCity(){
        List<City> cityList=null;
        try {
            cityList=cityDataService.listCity();
        } catch (Exception e) {
            logger.error("Exception",e);
        }
        return  cityList;
    }
}
